package com.zhouxujing.game;

import java.awt.Graphics;
import java.awt.Image;
import java.awt.Rectangle;

public abstract class GameObject {
	
	private Image img;//图像
	private int width,height;//像素的宽度和高度
	private double x,y;//坐标x和y
	
	

	public Image getImg() {
		return img;
	}

	public void setImg(Image img) {
		this.img = img;
	}

	public int getWidth() {
		return width;
	}

	public void setWidth(int width) {
		this.width = width;
	}

	public int getHeight(){
		return height;
	}

	public void setHeight(int height) {
		this.height = height;
	}
	public double getX(){
		return x;
	}
	public double getY(){
		return y;
	}
	
	//下面四个方法均为设置飞机的坐标，及让飞机移动move
	public void move(double x,double y){
		this.x=x;
		this.y=y;
	}
	public void moveX(double x){
		this.x=x;
	}
	public void moveY(double y){
		this.y=y;
	}
	public void setPosition(double x,double y){
		move(x,y);
	}
	/** 
	 * 抽象方法
	 */
	public abstract void drawSelf(Graphics g);
    /**
     * 抽象方法
     */
	public abstract void checkLocation();
	/**
	 * 
	 */
	public abstract void move();
	/**
	 * 
	 */
	public Rectangle getRect(){
		return new Rectangle((int)x, (int)y, width, height);
	}
	
}
